<!DOCTYPe html>
<title>Test that the cast button does not show up in immersive mode</title>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<script src='../media-controls.js'></script>
<body></body>
<script>
async_test(t => {
  var old_immersive = internals.settings.immersiveModeEnabled;
  internals.settings.setImmersiveModeEnabled(true);
  t.add_cleanup(() => {
    internals.settings.setImmersiveModeEnabled(old_immersive);
  });

  var video = document.createElement('video');
  video.controls = true;
  document.body.appendChild(video);
  video.src = '../content/test.ogv';
  internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);

  video.addEventListener('canplaythrough', t.step_func_done(e => {
    assert_false(isCastButtonEnabled(video));
    assert_not_equals(mediaControlsButton(video, 'panel').style.display, 'none');
  }));
});
</script>
